package ro.imc.rest.server.transformer;

import org.apache.commons.collections.Transformer;

import ro.imc.rest.shared.dto.LearningObject;
import ro.imc.rest.shared.dto.LearningObjectStatus;

import de.imc.clixrestdto.course.RestCourse;


public class RestCourseToLearningObjectTransformer implements Transformer {

	@Override
	public Object transform(Object arg0) {
		RestCourse course = (RestCourse) arg0;
		LearningObject learningObject = new LearningObject();
		learningObject.setDescription(course.getDescription());
		learningObject.setEndDate(course.getEndDate());
		learningObject.setId(String.valueOf(course.getId()));
		learningObject.setLanguage(course.getLanguage());
		learningObject.setLearningForm(course.getLearningForm());
		learningObject.setLocation(course.getLocation());
		learningObject.setModified(course.getModified());
		learningObject.setName(course.getName());
		learningObject.setStartDate(course.getStartDate());
		learningObject.setStatus(LearningObjectStatus.fromValue(course.getStatus().name()));
		learningObject.setBookable(course.isBookable());
		learningObject.setFinishable(course.isFinishable());
		return learningObject;
	}

}
